import 'dart:collection';

class CourtDetailModel {
  int? courtId;
  String? courtName;
  String? courtAddress;
  String? courtTelephone;
  String? distance;
  String? poiId;
  double? lng;
  double? lat;
  List<CourtImages>? courtImages;
  List<ActivityClubVOS>? activityClubVOS;

  CourtDetailModel(
      {this.courtId,
      this.courtName,
      this.courtAddress,
      this.courtTelephone,
      this.distance,
      this.poiId,
      this.lng,
      this.lat,
      this.courtImages,
      this.activityClubVOS});

  CourtDetailModel.fromJson(Map<String, dynamic> json) {
    courtId = json['courtId'];
    courtName = json['courtName'];
    courtAddress = json['courtAddress'];
    courtTelephone = json['courtTelephone'];
    distance = json['distance'];
    poiId = json['poiId'];
    lng = json['lng'];
    lat = json['lat'];
    if (json['courtImages'] != null) {
      courtImages = <CourtImages>[];
      json['courtImages'].forEach((v) {
        if (v != null) {
          courtImages!.add( CourtImages.fromJson(v));
        }
      });
    }
    if (json['activityClubVOS'] != null) {
      activityClubVOS = <ActivityClubVOS>[];
      json['activityClubVOS'].forEach((v) {
        activityClubVOS!.add( ActivityClubVOS.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['courtId'] = courtId;
    data['courtName'] = courtName;
    data['courtAddress'] = courtAddress;
    data['courtTelephone'] = courtTelephone;
    data['distance'] = distance;
    data['poiId'] = poiId;
    data['lng'] = lng;
    data['lat'] = lat;
    if (courtImages != null) {
      data['courtImages'] = courtImages!.map((v) => v.toJson()).toList();
    }
    if (activityClubVOS != null) {
      data['activityClubVOS'] =
          activityClubVOS!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class CourtImages {
  int? courtBaseInfoId;
  String? courtImageUrl;
  String? courtImageTitle;

  CourtImages({this.courtBaseInfoId, this.courtImageUrl, this.courtImageTitle});

  CourtImages.fromJson(Map<String, dynamic> json) {
    courtBaseInfoId = json['courtBaseInfoId'];
    courtImageUrl = json['courtImageUrl'];
    courtImageTitle = json['courtImageTitle'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['courtBaseInfoId'] = courtBaseInfoId;
    data['courtImageUrl'] = courtImageUrl;
    data['courtImageTitle'] = courtImageTitle;
    return data;
  }
}

class ActivityClubVOS {
  int? clubId;
  String? clubImage;
  String? clubName;

  ActivityClubVOS({this.clubId, this.clubImage, this.clubName});

  ActivityClubVOS.fromJson(Map<String, dynamic> json) {
    clubId = json['clubId'];
    clubImage = json['clubImage'];
    clubName = json['clubName'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['clubId'] = clubId;
    data['clubImage'] = clubImage;
    data['clubName'] = clubName;
    return data;
  }
}